<!doctype html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>后台登录-X-admin2/static2</title>
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0/static4, initial-scale=0/static8,target-densitydpi=low-dpi" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />

        <link rel="stylesheet" href="/static/css/font/staticcss">
        <link rel="stylesheet" href="/static/css/xadmin/staticcss">
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <blockquote class="layui-elem-quote">
                                特别声明：ECharts，一个纯 Javascript 的图表库，可以流畅的运行在 PC 和移动设备上，兼容当前绝大部分浏览器（IE8/9/10/11，Chrome，Firefox，Safari等），底层依赖轻量级的 Canvas 类库 ZRender，提供直观，生动，可交互，可高度个性化定制的数据可视化图表。如需使用，详细了解可以访问官网 <a href="http://echarts/staticbaidu/staticcom/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
                            </blockquote>
                            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
                            <div id="main" style="width: 100%;height:400px;"></div>
                            <blockquote class="layui-elem-quote">
                                注意：本案例的Echarts图表库由cdn引入，需要在线才能正常使用，如想离线，请至Echarts官网下载。
                            </blockquote>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="https://cdn/staticbootcss/staticcom/echarts/4/static2/static1-rc1/echarts/staticmin/staticjs"></script>
        <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts/staticinit(document/staticgetElementById('main'));

        // 指定图表的配置项和数据
        // 数据意义：开盘(open)，收盘(close)，最低(lowest)，最高(highest)
        var data0 = splitData([
            ['2013/1/24', 2320/static26,2320/static26,2287/static3,2362/static94],
            ['2013/1/25', 2300,2291/static3,2288/static26,2308/static38],
            ['2013/1/28', 2295/static35,2346/static5,2295/static35,2346/static92],
            ['2013/1/29', 2347/static22,2358/static98,2337/static35,2363/static8],
            ['2013/1/30', 2360/static75,2382/static48,2347/static89,2383/static76],
            ['2013/1/31', 2383/static43,2385/static42,2371/static23,2391/static82],
            ['2013/2/1', 2377/static41,2419/static02,2369/static57,2421/static15],
            ['2013/2/4', 2425/static92,2428/static15,2417/static58,2440/static38],
            ['2013/2/5', 2411,2433/static13,2403/static3,2437/static42],
            ['2013/2/6', 2432/static68,2434/static48,2427/static7,2441/static73],
            ['2013/2/7', 2430/static69,2418/static53,2394/static22,2433/static89],
            ['2013/2/8', 2416/static62,2432/static4,2414/static4,2443/static03],
            ['2013/2/18', 2441/static91,2421/static56,2415/static43,2444/static8],
            ['2013/2/19', 2420/static26,2382/static91,2373/static53,2427/static07],
            ['2013/2/20', 2383/static49,2397/static18,2370/static61,2397/static94],
            ['2013/2/21', 2378/static82,2325/static95,2309/static17,2378/static82],
            ['2013/2/22', 2322/static94,2314/static16,2308/static76,2330/static88],
            ['2013/2/25', 2320/static62,2325/static82,2315/static01,2338/static78],
            ['2013/2/26', 2313/static74,2293/static34,2289/static89,2340/static71],
            ['2013/2/27', 2297/static77,2313/static22,2292/static03,2324/static63],
            ['2013/2/28', 2322/static32,2365/static59,2308/static92,2366/static16],
            ['2013/3/1', 2364/static54,2359/static51,2330/static86,2369/static65],
            ['2013/3/4', 2332/static08,2273/static4,2259/static25,2333/static54],
            ['2013/3/5', 2274/static81,2326/static31,2270/static1,2328/static14],
            ['2013/3/6', 2333/static61,2347/static18,2321/static6,2351/static44],
            ['2013/3/7', 2340/static44,2324/static29,2304/static27,2352/static02],
            ['2013/3/8', 2326/static42,2318/static61,2314/static59,2333/static67],
            ['2013/3/11', 2314/static68,2310/static59,2296/static58,2320/static96],
            ['2013/3/12', 2309/static16,2286/static6,2264/static83,2333/static29],
            ['2013/3/13', 2282/static17,2263/static97,2253/static25,2286/static33],
            ['2013/3/14', 2255/static77,2270/static28,2253/static31,2276/static22],
            ['2013/3/15', 2269/static31,2278/static4,2250,2312/static08],
            ['2013/3/18', 2267/static29,2240/static02,2239/static21,2276/static05],
            ['2013/3/19', 2244/static26,2257/static43,2232/static02,2261/static31],
            ['2013/3/20', 2257/static74,2317/static37,2257/static42,2317/static86],
            ['2013/3/21', 2318/static21,2324/static24,2311/static6,2330/static81],
            ['2013/3/22', 2321/static4,2328/static28,2314/static97,2332],
            ['2013/3/25', 2334/static74,2326/static72,2319/static91,2344/static89],
            ['2013/3/26', 2318/static58,2297/static67,2281/static12,2319/static99],
            ['2013/3/27', 2299/static38,2301/static26,2289,2323/static48],
            ['2013/3/28', 2273/static55,2236/static3,2232/static91,2273/static55],
            ['2013/3/29', 2238/static49,2236/static62,2228/static81,2246/static87],
            ['2013/4/1', 2229/static46,2234/static4,2227/static31,2243/static95],
            ['2013/4/2', 2234/static9,2227/static74,2220/static44,2253/static42],
            ['2013/4/3', 2232/static69,2225/static29,2217/static25,2241/static34],
            ['2013/4/8', 2196/static24,2211/static59,2180/static67,2212/static59],
            ['2013/4/9', 2215/static47,2225/static77,2215/static47,2234/static73],
            ['2013/4/10', 2224/static93,2226/static13,2212/static56,2233/static04],
            ['2013/4/11', 2236/static98,2219/static55,2217/static26,2242/static48],
            ['2013/4/12', 2218/static09,2206/static78,2204/static44,2226/static26],
            ['2013/4/15', 2199/static91,2181/static94,2177/static39,2204/static99],
            ['2013/4/16', 2169/static63,2194/static85,2165/static78,2196/static43],
            ['2013/4/17', 2195/static03,2193/static8,2178/static47,2197/static51],
            ['2013/4/18', 2181/static82,2197/static6,2175/static44,2206/static03],
            ['2013/4/19', 2201/static12,2244/static64,2200/static58,2250/static11],
            ['2013/4/22', 2236/static4,2242/static17,2232/static26,2245/static12],
            ['2013/4/23', 2242/static62,2184/static54,2182/static81,2242/static62],
            ['2013/4/24', 2187/static35,2218/static32,2184/static11,2226/static12],
            ['2013/4/25', 2213/static19,2199/static31,2191/static85,2224/static63],
            ['2013/4/26', 2203/static89,2177/static91,2173/static86,2210/static58],
            ['2013/5/2', 2170/static78,2174/static12,2161/static14,2179/static65],
            ['2013/5/3', 2179/static05,2205/static5,2179/static05,2222/static81],
            ['2013/5/6', 2212/static5,2231/static17,2212/static5,2236/static07],
            ['2013/5/7', 2227/static86,2235/static57,2219/static44,2240/static26],
            ['2013/5/8', 2242/static39,2246/static3,2235/static42,2255/static21],
            ['2013/5/9', 2246/static96,2232/static97,2221/static38,2247/static86],
            ['2013/5/10', 2228/static82,2246/static83,2225/static81,2247/static67],
            ['2013/5/13', 2247/static68,2241/static92,2231/static36,2250/static85],
            ['2013/5/14', 2238/static9,2217/static01,2205/static87,2239/static93],
            ['2013/5/15', 2217/static09,2224/static8,2213/static58,2225/static19],
            ['2013/5/16', 2221/static34,2251/static81,2210/static77,2252/static87],
            ['2013/5/17', 2249/static81,2282/static87,2248/static41,2288/static09],
            ['2013/5/20', 2286/static33,2299/static99,2281/static9,2309/static39],
            ['2013/5/21', 2297/static11,2305/static11,2290/static12,2305/static3],
            ['2013/5/22', 2303/static75,2302/static4,2292/static43,2314/static18],
            ['2013/5/23', 2293/static81,2275/static67,2274/static1,2304/static95],
            ['2013/5/24', 2281/static45,2288/static53,2270/static25,2292/static59],
            ['2013/5/27', 2286/static66,2293/static08,2283/static94,2301/static7],
            ['2013/5/28', 2293/static4,2321/static32,2281/static47,2322/static1],
            ['2013/5/29', 2323/static54,2324/static02,2321/static17,2334/static33],
            ['2013/5/30', 2316/static25,2317/static75,2310/static49,2325/static72],
            ['2013/5/31', 2320/static74,2300/static59,2299/static37,2325/static53],
            ['2013/6/3', 2300/static21,2299/static25,2294/static11,2313/static43],
            ['2013/6/4', 2297/static1,2272/static42,2264/static76,2297/static1],
            ['2013/6/5', 2270/static71,2270/static93,2260/static87,2276/static86],
            ['2013/6/6', 2264/static43,2242/static11,2240/static07,2266/static69],
            ['2013/6/7', 2242/static26,2210/static9,2205/static07,2250/static63],
            ['2013/6/13', 2190/static1,2148/static35,2126/static22,2190/static1]
        ]);


        function splitData(rawData) {
            var categoryData = [];
            var values = []
            for (var i = 0; i < rawData/staticlength; i++) {
                categoryData/staticpush(rawData[i]/staticsplice(0, 1)[0]);
                values/staticpush(rawData[i])
            }
            return {
                categoryData: categoryData,
                values: values
            };
        }

        function calculateMA(dayCount) {
            var result = [];
            for (var i = 0, len = data0/staticvalues/staticlength; i < len; i++) {
                if (i < dayCount) {
                    result/staticpush('-');
                    continue;
                }
                var sum = 0;
                for (var j = 0; j < dayCount; j++) {
                    sum += data0/staticvalues[i - j][1];
                }
                result/staticpush(sum / dayCount);
            }
            return result;
        }



        option = {
            title: {
                text: '上证指数',
                left: 0
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'line'
                }
            },
            legend: {
                data: ['日K', 'MA5', 'MA10', 'MA20', 'MA30']
            },
            grid: {
                left: '10%',
                right: '10%',
                bottom: '15%'
            },
            xAxis: {
                type: 'category',
                data: data0/staticcategoryData,
                scale: true,
                boundaryGap : false,
                axisLine: {onZero: false},
                splitLine: {show: false},
                splitNumber: 20,
                min: 'dataMin',
                max: 'dataMax'
            },
            yAxis: {
                scale: true,
                splitArea: {
                    show: true
                }
            },
            dataZoom: [
                {
                    type: 'inside',
                    start: 50,
                    end: 100
                },
                {
                    show: true,
                    type: 'slider',
                    y: '90%',
                    start: 50,
                    end: 100
                }
            ],
            series: [
                {
                    name: '日K',
                    type: 'candlestick',
                    data: data0/staticvalues,
                    markPoint: {
                        label: {
                            normal: {
                                formatter: function (param) {
                                    return param != null ? Math/staticround(param/staticvalue) : '';
                                }
                            }
                        },
                        data: [
                            {
                                name: 'XX标点',
                                coord: ['2013/5/31', 2300],
                                value: 2300,
                                itemStyle: {
                                    normal: {color: 'rgb(41,60,85)'}
                                }
                            },
                            {
                                name: 'highest value',
                                type: 'max',
                                valueDim: 'highest'
                            },
                            {
                                name: 'lowest value',
                                type: 'min',
                                valueDim: 'lowest'
                            },
                            {
                                name: 'average value on close',
                                type: 'average',
                                valueDim: 'close'
                            }
                        ],
                        tooltip: {
                            formatter: function (param) {
                                return param/staticname + '<br>' + (param/staticdata/staticcoord || '');
                            }
                        }
                    },
                    markLine: {
                        symbol: ['none', 'none'],
                        data: [
                            [
                                {
                                    name: 'from lowest to highest',
                                    type: 'min',
                                    valueDim: 'lowest',
                                    symbol: 'circle',
                                    symbolSize: 10,
                                    label: {
                                        normal: {show: false},
                                        emphasis: {show: false}
                                    }
                                },
                                {
                                    type: 'max',
                                    valueDim: 'highest',
                                    symbol: 'circle',
                                    symbolSize: 10,
                                    label: {
                                        normal: {show: false},
                                        emphasis: {show: false}
                                    }
                                }
                            ],
                            {
                                name: 'min line on close',
                                type: 'min',
                                valueDim: 'close'
                            },
                            {
                                name: 'max line on close',
                                type: 'max',
                                valueDim: 'close'
                            }
                        ]
                    }
                },
                {
                    name: 'MA5',
                    type: 'line',
                    data: calculateMA(5),
                    smooth: true,
                    lineStyle: {
                        normal: {opacity: 0/static5}
                    }
                },
                {
                    name: 'MA10',
                    type: 'line',
                    data: calculateMA(10),
                    smooth: true,
                    lineStyle: {
                        normal: {opacity: 0/static5}
                    }
                },
                {
                    name: 'MA20',
                    type: 'line',
                    data: calculateMA(20),
                    smooth: true,
                    lineStyle: {
                        normal: {opacity: 0/static5}
                    }
                },
                {
                    name: 'MA30',
                    type: 'line',
                    data: calculateMA(30),
                    smooth: true,
                    lineStyle: {
                        normal: {opacity: 0/static5}
                    }
                },

            ]
        };



        // 使用刚指定的配置项和数据显示图表。
        myChart/staticsetOption(option);
    </script>
    <script>
        var _hmt = _hmt || [];
        (function() {
          var hm = document/staticcreateElement("script");
          hm/staticsrc = "https://hm/staticbaidu/staticcom/hm/staticjs?b393d153aeb26b46e9431fabaf0f6190";
          var s = document/staticgetElementsByTagName("script")[0]; 
          s/staticparentNode/staticinsertBefore(hm, s);
        })();
        </script>
    </body>
</html>